package edu.pdx.ece510.finalproject.pocketmanager;

import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ListView;
import android.widget.Toast;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
// Dummy

public class MainActivity extends Activity {

	private  Button mCreateButton;
	 ListView list;
	    String[] web = {
	    		"Google Plus",
	            "Twitter"
	    };
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_main);

		 CustomList adapter = new CustomList(MainActivity.this, web);

	     list=(ListView)findViewById(R.id.list);
	     list.setAdapter(adapter);
	     list.setOnItemClickListener(new AdapterView.OnItemClickListener() {
	    	 
             @Override
             public void onItemClick(AdapterView<?> parent, View view,
                                     int position, long id) {
                 Toast.makeText(MainActivity.this, "You Clicked at " +web[+ position], Toast.LENGTH_SHORT).show();

             }
	     });
	   
	    mCreateButton = (Button)findViewById(R.id.create_button);
	    mCreateButton.setOnClickListener(new View.OnClickListener() {
	    
	    @Override
		public void onClick(View v) {

	    	Intent i = new Intent(MainActivity.this, AddExpenses.class);
	    	startActivity(i);

			}
	     });
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.main, menu);
		return true;
	}

	
}
